import { MES_XSP_ApiHost } from '@/utils/Interceptors'

// 库存事务详情DTO接口
export interface InventoryTransactionDetailDTO {
  id: number
  productId: number
  productCode: string
  productName: string
  productSpec?: string
  inventoryUnit: string
  transactionQuantity: number
  changeQuantity: number
  transactionTime: string
  sourceDocumentType: string
  sourceDocumentNo: string
  inventoryType: string
  remark?: string
  createTime: string
  creator: string
  lastUpdateTime?: string
  currentInventory: number
  changeDirection: string
  absoluteChangeQuantity: number
}

// 库存事务查询参数接口
export interface InventoryTransactionQueryParams {
  pageIndex: number
  pageSize: number
}

// API响应接口 - 根据实际API响应结构调整
export interface ApiPaging<T> {
  totalCount: number
  totalPage: number
  pageData: T[]
  code: number
  msg: string
  data: any
}

// 获取库存事务列表（分页）
export const getInventoryTransactionList = async (params: InventoryTransactionQueryParams): Promise<{ data: ApiPaging<InventoryTransactionDetailDTO> }> => {
  return await MES_XSP_ApiHost.get('/api/InventoryTransactionGetInventoryTransactionList', { params })
} 